package com.glsc.ngateway.shortmsg.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * @Author: zzp
 * @Date: 20200527
 * @Desc: 多DataSource配置
 */

@Configuration
public class DataSourceDefConfig {
    private static Logger logger = LoggerFactory.getLogger(DataSourceDefConfig.class);

    public static final String DS_MYSQL = "datasourceMysql";
//    public static final String DS_MYSQL_FlOWABLE = "datasourceMysqlFlowable";

    @Bean(name = DS_MYSQL)
    @Primary
    @ConfigurationProperties("spring.datasource.mysql")
    public DataSource datasourceMysql() {
        return DataSourceBuilder.create().build();
    }

//    @Bean(name = DS_MYSQL_FlOWABLE)
//    @ConfigurationProperties("spring.datasource.mysqlflowable")
//    public DataSource datasourceMysqlFlowable() {
//        return DataSourceBuilder.create().build();
//    }

}